array, the current array contains one backup device. "-c128" indicates that the block size is kb and the default value is 64 KB. "/dev/sd [B, c, d, e] 1 "indicates all device identifiers contained in the current array. It can also be separated by spaces. The last one is the backup device.
3. view the array status
When creating a new array or array reconstruction, the device needs to perform synchronization. This process takes some time. You can view the/proc/
increase capacity directly3. If the hard drive to create the raid is large, it may take a while for Cat/proc/mdstat to see the progressCreate a good software RAID corresponding to/dev/mdn,n for digitalRAID information is saved in the/proc/mdstat file and can be viewed through the mdadm commandMdadm-C Create a new raid-S off specify raid, uninstall before closing-R re-enable specified RAID (requires restart
operation, "/dev/md0" indicates the name of the new RAID array device, and "/dev/sd [bcd] 1" indicates the array.
The/dev/sdb1,/dev/sdc1, and/dev/sdd1 columns are used. The meanings of other options and parameters are as follows:
„-C, equivalent to -- create: create a new array device
-V, equivalent to -- verbose: output details during execution
-A, equivalent to -- auto =: If the parameter is set to yes, it indicates that if the corresponding device file does not exist, it is automatically cre
. Take a moment to relax, so that you can be calm and know how to deal with the failure of the drive.
Well, first install a RAID volume. if you need to review how to implement this, see my previous article. To perform this test, you must install your own RAID-1 volume to disconnect a hard drive because it will be the way we simulate drive failure, you can still boot the Linux system.
After installing your own volume, if you execute the cat/proc/mdstat
performance write performance Security purpose NB Sp Application Industries 0 2 0 n n n One hard drive exception, Pursue maximum capacity NBS P 3D industry real-time rendering, All hard drives will be abnormal speed video splicing cache1 2 n-1 1 n 1 highest, one is pursuing the largest Personal, Enterprise backupConstant security 5 3 1 n-1 n-1 n-1 High Pursuit of maximum capacity personal, enterprise backup, minimum budget 4 N/2 n/2 n N/2 High s
encountered in the use. The current system generally has the MD drive module directly compiled into the kernel or compiled into a dynamically loaded driver module, we can after the machine started through the cat/proc/ Mdstat See if the kernel has either loaded the MD driver or cat/proc/devices a MD block device, and can use LSMOD to see if MD can load the module into the system.[ROOT@TESTGGV ~]# Cat/proc/mdstatPersonalities:Unused devices:[ROOT@TEST
= 31456256 K mtime = Thu Jan 1 08:00:00 1970
Mdadm: Note: This array has metadata at the start and
May not be suitable as a boot device. If you plan
Store'/boot' on this device please ensure that
Your boot-loader understands MD/v1.x metadata, or use
-- Metadatabase = 0.90
Mdadm:/dev/sdb1 appears to contain an ext2fs File System
Size = 31456256 K mtime = Thu Jan 1 08:00:00 1970
Mdadm: size set to 31439744 K
Continue creating array? (Y/n) y
Mdadm: defaulting to version 1.2 metadata
Mdadm: array/d
1. Add five new disks to the Virtual Machine
2. fdisk/dev/SDB, add three 1g partitions and set the type to FD (Linux raid autodetect)
3. dd If =/dev/SDB of =/dev/sdx BS = 1024 COUNT = 1 (copy the Partition Table of SDB to another disk)
Fdisk/dev/sdx and save it by W (otherwise, the device files in the/dev/sdxx partitions do not exist)
4. Create a raid0
Mdadm-C/dev/md0-l0-N2/dev/sdb1/dev/sdc1
Disable md0
Mdadm-S/dev/md0
Enable md0
Mdadm-A/dev/md0/dev/sdb1/dev/sdc1
5. Create raid1
Mdadm-C/dev/md1-
Soft RAID 1 replace bad disk 1. buy a hard disk of the same size. install the new hard disk on the machine. partition the hard disk and set the t type to: quot; fd quot; (the new drive letter is/dev/sdb # fdisk/dev/sdb4. run quot; partprobe quot; let the kernel reload the partition table 5. stop RAID1 mounting... soft RAID 1 replace bad disk 1. buy a hard disk of the same size. install the new hard disk on the machine. partition the hard disk and set the t type to "fd" (the new drive letter
=" Wkiol1g_n6lbydahaabmem8nhly937.png "/>OK, to this RAID 1 is a successful creation!As I said earlier, RAID 1 is the biggest feature of a hot backup, that is, when one of the disks has a problem and does not result in data loss, then I would like to simulate a disk failure:First, let's take a look at the configuration file/proc/mdstat get the disk array information:650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8A/F4/wKiom1g_yV2heIoSAAA1M
. Because the disk needs to be synchronized, you can view the/proc/mdstat file. The file displays the current raid status and the time required for synchronization.# Cat/proc/mdstatThe system displays --Personalities: [raid1]Read_ahead 1024 sectorsEvent: 1Md0: Active raid1 sdb1 [0] sdc1 [1] sdd1 [2]18432000 blocks [2/2] [UU]Unused devices:After the preceding prompt is displayed, the created RAID 1 is ready for use.
Step 4: edit the array configuration
device_pscinit function to enable the power clock of each module. The essence is to call the register implementation of the PSC power clock management module. The function content is as follows:
Void device_pscinit (){Unsigned char I = 0;Unsigned char lpsc_start;Unsigned char lpsc_end, lpscgroup, lpscmin, lpscmax;Unsigned int pdnum = 0;Lpscmin = 0;Lpscmax = 2;For (lpscgroup = lpscmin; lpscgroup If (lpscgroup = 0){Lpsc_start = 0; // enabling lpsc 3 to 28 SCR first
Lpsc_end = 28;}Else if (lpscgro
/dev/sdb
View the/proc/partitions file to verify the verification result.
Input: cat/proc/partitions
Here we can see sdb5 and sdb6.
Input: mdadm-C/dev/md0-l 0-a yes-n 2/dev/sdb5/dev/sdb6
The creation is successful:
Input: cat/proc/mdstat for verification
The device of RAID0 has been created. to use it, you must create a file system on the device.
Note: Because sdb5 and sdb6 have already formed a RAID0 device md0, you must create a file system on m
/mnt/raid ext3 defaults 0 0
Iv. Fault Testing
1. Create a file under/mnt/radi before testing
[Root @ centos raid] # ll/| tee./ls.txt
The mdadm built-in command can mark a hard disk as damaged. For more information, see "Help mdadm -- manage? H.
The sda hard disk is damaged during the fault test.
[Root @ centos/] # mdadm/dev/md0-f/dev/sda1
Mdadm: set/dev/sda1 faulty in/dev/md0
2. view the status
[Root @ centos/] # more/proc/mdstat
Personaliti
/dev/md0 -- level = 5 -- raid-devices = 3/dev/sdb1/dev/sdc1/dev/sdd1
View the progress information displayed in the/proc/mdstat file when creating a disk array.
# Cat/proc/mdstat
Although the mdadm command does not require a configuration file, we recommend that you configure a configuration file. Use the following command to provide a complete configuration file
# Echo DEVICE/dev/sbd1/dev/
I recently learned how to configure raid in linux as follows:1. Preliminary workChange the system id of the partition to fd.2. raidMdadm-C/dev/md2-l 5-n 3/dev/sdb8/dev/sdb9/dev/sdb10-C is the name specified for creating a raid volume/dev/md2-L the specified raid level is also a raid type.-N: specify several devices (partition or hard disk) to create a raid volume.3. view the raid volume status# Cat/proc/mdstat[Root @ client/] # cat/proc/mdstatPersonal
find the raidtools program at kernel.org. Find the latest "raidtools-0.90" file (not raid0145 !). The latest is raidtools-19990824-0.90.tar.gz ".
If you are adventurous (if you are using the 2.4.0-test kernel, you are taking an adventure), you may want to visit the RedHat website (see reference resources) obtain the latest version of raidtools that you can find. The latest is raidtools-dangerous-0.90-20000116.tar.gz ".
To install raidtools, unpack the archive file. Run the following comma
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.